UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rcIVvNhCYhYNH9GDcwJ0KY8ZDs+2gP8wqTpc6l91PqI=' 
WHERE 
  key_id = 'cc34b2739da4fe2178e16a5d57b153748d735e159029a2130df5ac4571d39a34' 
  AND (
    token = 'rcIVvNhCYhYNH9GDcwJ0KY8ZDs+2gP8wqTpc6l91PqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016