UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RU08fgYTFUm9kaubQUkxEJkFwidbkZmGm11572x23xc=' 
WHERE 
  key_id = 'fa8c2a928449f607d7801c1a05ab521c757feb46703689d429a5224c9319160d' 
  AND (
    token = 'RU08fgYTFUm9kaubQUkxEJkFwidbkZmGm11572x23xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020