UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IQMHA/Pa+LeroosYGTEhV9MvOOLlKZ2yfZ/LQ8Xxz0E=' 
WHERE 
  key_id = '8c1ba05deee1ff199b0e65637f7a9619205f68bd44edbfbe94956a017c41719a' 
  AND (
    token = 'IQMHA/Pa+LeroosYGTEhV9MvOOLlKZ2yfZ/LQ8Xxz0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042