UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PRqJkCyngxSK2uGr59zoGpGK4h+KDr5pKafQXsrN/00=' 
WHERE 
  key_id = '238ad845779ca5830b6d9db2c26a17c34a812827c24b4039699f71cccf817a02' 
  AND (
    token = 'PRqJkCyngxSK2uGr59zoGpGK4h+KDr5pKafQXsrN/00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026