UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qM80rFBKz6d8Ou3e2Mc7hwh0+I8ceA4cOKRLXlRlzhA=' 
WHERE 
  key_id = '930fa1d93a80cd96ee84d046fbe2c0a062b0198790c67ecc7461c3edbc9546a0' 
  AND (
    token = 'qM80rFBKz6d8Ou3e2Mc7hwh0+I8ceA4cOKRLXlRlzhA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030