UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k7QaBjzs4MnuDmeU4HY8gzRyYV6N8TylQ3ewjl/eYZ4=' 
WHERE 
  key_id = '99c740cb5b165586ed2e58bf57d0a50b61d8d245f47f12a20330feb02d91d38e' 
  AND (
    token = 'k7QaBjzs4MnuDmeU4HY8gzRyYV6N8TylQ3ewjl/eYZ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027