UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TJtlsIYBKAmlPF4KUudbIDC3W+CyU4LETwRN3lRqiYI=' 
WHERE 
  key_id = 'd9f4f921eb72e56d04a190baa331d94b0aa9b12dcd0dc70610983436ebd36014' 
  AND (
    token = 'TJtlsIYBKAmlPF4KUudbIDC3W+CyU4LETwRN3lRqiYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018