UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nbFqI3Lv11ASRDtboY7q8u566YgQLytWauyxIZoXU5M=' 
WHERE 
  key_id = '300ea7565a45964c4eeb0b35bbf953fcbf3368318aa7ffb95858cc25156bf3b1' 
  AND (
    token = 'nbFqI3Lv11ASRDtboY7q8u566YgQLytWauyxIZoXU5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032