UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XHDMeIGzgVbatKebC7YjnK0rvQXGtyh259tuwFB7ZqA=' 
WHERE 
  key_id = '20e093aeb9b8f27c3c9491101b2c8cd6919def16d4ac9d12782874f72f78fe2e' 
  AND (
    token = 'XHDMeIGzgVbatKebC7YjnK0rvQXGtyh259tuwFB7ZqA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046