UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x8z4j6cmTDdZdS2X+PZ2ucchyPtrDsT4ocNs2ZXoHKQ=' 
WHERE 
  key_id = '7fe89d6a94534378f462765d10059d1e0ea9e9c5451a1a527332088a2be6e0e0' 
  AND (
    token = 'x8z4j6cmTDdZdS2X+PZ2ucchyPtrDsT4ocNs2ZXoHKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031