UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BnyQid9dEB+KrX/DNf9MBW/C7T9COH3PGLAL+T/MpGk=' 
WHERE 
  key_id = 'e44b7101780619841406c23d7d76fc834a96c0407dda4e7f2e3a03cc09985360' 
  AND (
    token = 'BnyQid9dEB+KrX/DNf9MBW/C7T9COH3PGLAL+T/MpGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025