UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QU7oqC9dMWeM9GkTqCUGEHPULkWn/5OP7SQ55sAhxZk=' 
WHERE 
  key_id = 'dc6506be06a0cb71431373aaff469b537b161060776155639c4358a1e7c29b85' 
  AND (
    token = 'QU7oqC9dMWeM9GkTqCUGEHPULkWn/5OP7SQ55sAhxZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00147