UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RC1KDkRjnWmo5zk6jrE6ZNvPRUVs6xa+GrmoAUygSso=' 
WHERE 
  key_id = 'cdd6701f6401712a0f198ea633a0d40bc4816cc008f3fda7cce0d47055076468' 
  AND (
    token = 'RC1KDkRjnWmo5zk6jrE6ZNvPRUVs6xa+GrmoAUygSso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037