UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'as3OZIP7oJR7ndfascv8Jk0JOSdh99JKdOpencPgPL0=' 
WHERE 
  key_id = 'dd1beeab10b7131e7ef0c76e4aa00e90210b63a39c5605c06a0401d620bad686' 
  AND (
    token = 'as3OZIP7oJR7ndfascv8Jk0JOSdh99JKdOpencPgPL0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037