UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f2szjv6WlrWLoHOkwko4B5vE6DKiOOT+TAXM+stv27A=' 
WHERE 
  key_id = '78d6034942857227b01539abea3297f79b0205157c24812b989f0153e70f9760' 
  AND (
    token = 'f2szjv6WlrWLoHOkwko4B5vE6DKiOOT+TAXM+stv27A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026