UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NY1hmz5/w7W44mr8jTcNhDWDezpQ/qghLBEjLjlNOfc=' 
WHERE 
  key_id = 'ba929eb891ca7d7c95c0ff54d5d00056c49348e493b8359b0a8cadedbd61e4f4' 
  AND (
    token = 'NY1hmz5/w7W44mr8jTcNhDWDezpQ/qghLBEjLjlNOfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028