UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YYbGv5ygaDrswXHN4XN/mHSvdwXwrdIfKv+h3rsAZRI=' 
WHERE 
  key_id = '6d247020f7597dc807eb6c9b466af3e44dedf6073c5a02d97f60c478afc23843' 
  AND (
    token = 'YYbGv5ygaDrswXHN4XN/mHSvdwXwrdIfKv+h3rsAZRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038