UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xiAoZc1SJxpHK/Hr+iH23M3GQwSgvI0PjVsZYtGxS0Y=' 
WHERE 
  key_id = '042020d7122184063a60ba30d0c15d8c6c819a8d711c017228af940323f72455' 
  AND (
    token = 'xiAoZc1SJxpHK/Hr+iH23M3GQwSgvI0PjVsZYtGxS0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026