UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8N7Te07B19XmhW3cfnWqnIl50os0Hl2lLcMYSEyBeLo=' 
WHERE 
  key_id = 'b8a1ece59d943dea2e4d3a9aead8c286e2ce9e7f2f38b9450bfc4a303434aa0b' 
  AND (
    token = '8N7Te07B19XmhW3cfnWqnIl50os0Hl2lLcMYSEyBeLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037