UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tp3x3ODdSwJJZP5czKuiynnLTyguIJ5T0Rifak1Q/QQ=' 
WHERE 
  key_id = 'f589d4ed7e294bbc856bf9aff122377b8ced8ccae63063e3fc67c5d12bfd748f' 
  AND (
    token = 'Tp3x3ODdSwJJZP5czKuiynnLTyguIJ5T0Rifak1Q/QQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029