UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0PCJdfb9k4NYzQi3A+NROsaNcvvelqADriuHqW46YNU=' 
WHERE 
  key_id = 'cb0e193b590ec79eb1f496492c0c1848e10892086aadbae5347f42ce859cf35a' 
  AND (
    token = '0PCJdfb9k4NYzQi3A+NROsaNcvvelqADriuHqW46YNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041