UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pZHhpdb2yHLcbDfNmTlvRMonZLofw+aGb0Lt1ONjPJw=' 
WHERE 
  key_id = 'afc25e8e436685f019c3950131c9a4750e6305aa15090df66ff8cc4d92408d81' 
  AND (
    token = 'pZHhpdb2yHLcbDfNmTlvRMonZLofw+aGb0Lt1ONjPJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041