UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AAylVExuPnhRbDCPvKvke9YcDtJqEhW3OF4j2sfJD9A=' 
WHERE 
  key_id = '1ddc9e9768eca2b951dc92023694a872bc588dc8c4aadaf667693d3daa525500' 
  AND (
    token = 'AAylVExuPnhRbDCPvKvke9YcDtJqEhW3OF4j2sfJD9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026