UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BcLK+EZT/NFZJpaL1Xn2/LHgwUWfJzQtGd6Cc3TYaF0=' 
WHERE 
  key_id = 'e98f06b2d30bd2a381893bcccffdff02e88960c367da607a1719a57ebaff85d6' 
  AND (
    token = 'BcLK+EZT/NFZJpaL1Xn2/LHgwUWfJzQtGd6Cc3TYaF0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040