UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mFi015j/XaTp480BcQ0lseglJ+d3k3pf5EFoyLsWF14=' 
WHERE 
  key_id = '7e2e319e9384b929b7c823c9f2dea3331092e15a9fcfe7071179e80282828307' 
  AND (
    token = 'mFi015j/XaTp480BcQ0lseglJ+d3k3pf5EFoyLsWF14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038