UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RRclZrKQ0v1Qu1A3UY4U1/PcaUT18NtXAm3iTzJ3yM0=' 
WHERE 
  key_id = '136d21914bb1861debf34d284e15266c05a1122599481ada5b000d49be7b50ca' 
  AND (
    token = 'RRclZrKQ0v1Qu1A3UY4U1/PcaUT18NtXAm3iTzJ3yM0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029