UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O3dJYk7YjH8x/PSnXM/LSYToYWY4anI7CXgA6C8YPAU=' 
WHERE 
  key_id = '8b42e511a45acb83e478e2505a78b0b6c32aec7e9a9eb7780573f39ef4e619de' 
  AND (
    token = 'O3dJYk7YjH8x/PSnXM/LSYToYWY4anI7CXgA6C8YPAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017